import http from '@/utils/request'
import { ParamsType } from '@/types/category'

/**
 * 获取首页头部分类数据
 */
export const findAllCategory = () =>
  http({
    url: '/home/category/head'
  })

/**
 * 获取当个顶级分类信息
 */
export const findTopCategory = (id: string) =>
  http({
    url: '/category',
    params: { id }
  })

/**
 * 获取二级分类筛选条件数据
 */
export const findSubCategoryFilter = (id: string) =>
  http({
    url: '/category/sub/filter',
    params: { id }
  })

/**
 * 获取分类下的商品 (带筛选条件)
 */
export const findSubCategoryGoods = (data: ParamsType) =>
  http({
    url: '/category/goods/temporary',
    method: 'post',
    data
  })
